# Makefile for statemachine calculator

CFLAGS := -g -Wall -ansi -pedantic
CC := g++ $(CFLAGS)

SOURCES := main.cc calc.cc calcexception.cc number.cc \
 	 parser.cc languageparser.cc nativeparser.cc numrule.cc
ALLOBJS := $(patsubst %.cc,%.o,$(SOURCES))

# 
# big action
all: calc

.PHONY: clean

clean:
	rm -f *.o calc

#
# header dependency list

calc.o: numrule.h number.h parser.h languageparser.h defs.h nativeparser.h calcexception.h
numrule.o: number.h calcexception.h
main.o: calc.h
parser.o: number.h
languageparser.o: numrule.h parser.h number.h calc.h
nativeparser.o: number.h calcexception.h


#
# best of the rest

calc: $(ALLOBJS)
	$(CC) -o $@ $(ALLOBJS)

# need to separate this one as there is no header
main.o: main.cc
	$(CC) -c -o $@ $<

%.o: %.cc %.h
	$(CC) -c -o $@ $<

